package com.sundi.ecusers.web;


import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.sundi.eccommon.vo.ResultEntity;
import com.sundi.ecusers.dto.EcAddressDto;
import com.sundi.ecusers.service.IEcUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author Mht
 * @since 2020-02-26
 */
@RestController
@RequestMapping("/ecUser")
public class EcUserController {

    @Autowired
    IEcUserService iEcUserService;

    /**
     * 会员管理页面，模糊查询
     * @param user_name
     * @param ecAddressDto
     * @return
     */
    @RequestMapping("getUserList")
    public ResultEntity getUserList(String user_name, EcAddressDto ecAddressDto){

        PageHelper.startPage(ecAddressDto.getPageNo(),ecAddressDto.getPageSize());
        List userList = iEcUserService.getUserList(user_name);
        PageInfo pageInfo = new PageInfo(userList);
        return ResultEntity.ok(pageInfo);
    }
}
